package cn.crce.cloud9.simple;

import javax.swing.*;
import java.awt.*;

/**
 * @author OnCloud9
 * @description
 * @project NRCE-TEST
 * @date 2022年09月10日 上午 10:25
 */
public class Case31 {
    public static void main(String[] args) {
        WelcomeFrame frame = new WelcomeFrame();
//*********Found**********
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
}

//*********Found**********
class WelcomeFrame extends JFrame {
    public WelcomeFrame() {
        setTitle("Java等级考试");
//*********Found**********
        setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
        WelcomePanel panel = new WelcomePanel();
        Container contentPane = getContentPane();
        contentPane.add(panel);
    }

    public static final int DEFAULT_WIDTH = 250;
    public static final int DEFAULT_HEIGHT = 100;
}

//*********Found**********
class WelcomePanel extends JPanel {
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.drawString("欢迎参加Java等级考试！", MESSAGE_X, MESSAGE_Y);
    }

    public static final int MESSAGE_X = 60;
    public static final int MESSAGE_Y = 50;
}
